package com.nageoffer.jobtrain.projects.dao.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * OJ题目ES实体类
 * author：唐晨
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Document(indexName = "index_oj_question")
public class OjQuestionESDO {
    /**
     * oj题主键id
     */
    @Id
    @Field(type = FieldType.Long)
    private Long id;

    /**
     * 题目标题
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String title;

    /**
     * 题目难度；0：简单，1：中等，2：困难
     */
    @Field(type = FieldType.Byte)
    private Integer difficulty;

    /**
     * 时间限制
     */
    @Field(type = FieldType.Long)
    private Integer timeLimit;

    /**
     * 空间限制
     */
    @Field(type = FieldType.Long)
    private Integer spaceLimit;

    /**
     * 题目描述内容
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String content;

    /**
     * 题目测试用例（json格式）
     */
    @Field(type = FieldType.Text)
    private String questionCase;

    /**
     * 默认代码块
     */
    @Field(type = FieldType.Text)
    private String defaultCode;

    /**
     * main函数
     */
    @Field(type = FieldType.Text)
    private String mainFunction;

    /**
     * 是否通过该道题标识 0：未通过；1：通过
     */
    @Field(type = FieldType.Long)
    private Integer pass;

    /**
     * 创建时间
     */
    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private Date createTime;
}
